﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_resources_Default" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link href="../image/style.css" type="text/css" rel="Stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="../../js/jquerypage.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var getcount = { "act": "getcount" };
        $.getJSON("../../Handles/resource/getlist.ashx", $.param(getcount),
        function (data) {
            var json = $.parseJSON(data);
            $("#page").pagination(json.count, {
                callback: pageselectfn,
                prev_text: "上一页",
                next_text: "下一页",
                items_per_page: 20,
                num_display_entries: 6,
                current_page: 0,
                num_edge_entries: 2,
            });
        });
    });
    function InitData(page) {
        page = page + 1;
        var getlist = { "act": "getlist", "page": page };
        $("#listtable").toggle(600);
        $.ajax({
            url: "../../Handles/resource/getlist.ashx",
            type: "POST",
            datatype: "xml",
            data: $.param(getlist),
            success: function (xml) {
                $("#reslisttable").empty();
                $(xml).find("ds").each(function (v) {
                    var html = "<tr>";
                    html += '<td style="text-align:center">' + $(this).attr("ResID") + '</td>';
                    html += '<td>' + $(this).children("Title").text() + '</td>';
                    html += '<td style="text-align:center">' + $(this).children("ClassID").text() + '</td>';
                    html += '<td style="text-align:center"><a href="add.aspx?act=edit&resid='+$(this).attr("ResID")+'" >编辑</a>|<a href="#">删除</a></td>';
                    $("#reslisttable").append(html);
                });
                $("#listtable").toggle(600);
            }
        });
    }
    function pageselectfn(page) {
        InitData(page);
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<div style="width:100%">
    <br /> <h2>资源列表</h2><br />
        <table id="listtable">
        <thead>
            <tr style="background-color:Gray">
                <td style="text-align:center;width:80px"> ID</td>
                <td style="text-align:center;width:440px">标题</td>
                <td style="text-align:center;width:80px">分类ID</td>
                <td style="text-align:center;width:80px">操作</td>
            </tr>
        </thead>
        <tbody id="reslisttable">
            
        </tbody>
         </table>
         <div id="page" style="text-align:center" class="pagination">
         </div>
         </div>
</asp:Content>

